import torch
import torchvision
# from model_save import *

# 加载方式1：保存方式一加载模型
model = torch.load('vgg16_method1.pth')
# print(model)

# 加载方式2：保存方式二加载模型
vgg16 = torchvision.models.vgg16(weights='DEFAULT')
vgg16.load_state_dict(torch.load('vgg16_method2.pth'))
# model = torch.load('vgg16_method1.pth')
# print(vgg16)

# 陷阱1
model1 = torch.load('net_method1.pth')
"""
AttributeError: Can't get attribute 'Net' on <module '__main__' from
'E:\\Rocli\\学习笔记\\python学习\\pytorchStudy\\pytorchStudyCode\\model\\model_load.py'>
要想解决这个问题，需要引入model_save中对应的模型
"""
print(model1)
